package com.zzti.contril;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zzti.Dao.EmployeeDao;
import com.zzti.Thired.Employee;
import com.zzti.impl.EmployeeDaoimpl;



/**
 * Servlet implementation class DeleteServlet
 */
public class DeleteServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//HttpSession session=request.getSession();
//		session.setAttribute("Emname", "4");
	//	session.removeAttribute("Emname"); 
		String name=request.getParameter("Emname");
		EmployeeDao ed=new EmployeeDaoimpl() ;
		System.out.print(name);
	int i=	ed.DeleteEmployee(name);
	if(i>0) {
		//request.getRequestDispatcher("showEmployee.jsp").forward(request, response);
		response.sendRedirect("EmployeeServlet");
	}	else {
		request.getRequestDispatcher("Login1.jsp").forward(request, response);
	}
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}